package com.nbsaas.boot.site.rest.convert;

import com.nbsaas.boot.site.data.entity.DynamicPage;
import com.nbsaas.boot.site.api.domain.response.DynamicPageResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
/**
* -实体对象转化成响应对象
*/

public class DynamicPageResponseConvert  implements Converter<DynamicPageResponse,DynamicPage> {

    @Override
    public DynamicPageResponse convert(DynamicPage source) {
        DynamicPageResponse  result = new  DynamicPageResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getDynamicPageCatalog()!=null){
                        result.setDynamicPageCatalog(source.getDynamicPageCatalog().getId());
                    }

                    try {
                        if(source.getDynamicPageCatalog()!=null){
                            result.setDynamicPageCatalogName(source.getDynamicPageCatalog().getName());
                        }
                    } catch (Exception ignored) { }

        return result;
    }

}

